#include <QtGui/QApplication>
#include <QTextCodec>
#include <QDebug>

#include "mainwindow.hpp"
#include "../../src/log.hpp"

int main(int argc, char *argv[])
{
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));

    if (argc > 1)
        Log::init("log/client2.txt");
    else
        Log::init("log/client.txt");
    qInstallMsgHandler(Log::myMessageOutput);

    QApplication a(argc, argv);

    MainWindow w;

    if (argc > 1)
        w.move(QString(argv[1]).toInt(), 350);
    else
        w.move(450, 350);

    w.show();
    return a.exec();
}
